package flst.ipiweb.service;

import java.util.ArrayList;
import java.util.List;

import flst.ipiweb.common.DeliveryRecipient;
import flst.ipiweb.common.TypeLivraison;
import flst.ipiweb.dao.DAOFactory;

public class ServiceLivraison {

	public List<TypeLivraison> getTypeLivraisonList() {

		try {
			return DAOFactory.getLivraisonDAO().getTypeLivraisonList();
		} catch (Exception e) {
			return new ArrayList<TypeLivraison>();
		}

	}

	public boolean updateTypeLivraison(TypeLivraison typeLivraison) {

		try {
			return DAOFactory.getLivraisonDAO().updateTypeLivraison(typeLivraison);
		} catch (Exception e) {
			return false;
		}

	}

	public List<DeliveryRecipient> getRelaisList() {

		try {
			return DAOFactory.getLivraisonDAO().getRelaisList();
		} catch (Exception e) {
			return new ArrayList<DeliveryRecipient>();
		}

	}

	public boolean updateRelais(DeliveryRecipient relais) {

		try {
			return DAOFactory.getLivraisonDAO().updateRelais(relais);
		} catch (Exception e) {
			return false;
		}

	}


	public boolean deleteRelais(int relai) {

		try {
			return DAOFactory.getLivraisonDAO().deleteRelais(relai);
		} catch (Exception e) {
			return false;
		}

	}
	
	
	public DeliveryRecipient getRelaiById(int idRelai)  {

		try {
			return DAOFactory.getLivraisonDAO().getRelaiById(idRelai);
		} catch (Exception e) {
			return new DeliveryRecipient();
		}

	}
	
	public boolean createRelai(DeliveryRecipient relai)  {

		try {
			return DAOFactory.getLivraisonDAO().createRelai(relai);
		} catch (Exception e) {
			return false;
		}

	}
}
